{include file="app/admin/view/header.html"}
<link rel="stylesheet" href="*ADMIN*/css/set.css">
<style type="text/css" media="all">
.layui-card-body, .layui-card-header, .layui-form-label, .layui-form-mid, .layui-form-select, .layui-input-block, .layui-input-inline, .layui-textarea {
    position: initial;
}
.addonsfuzhi {
    border: 1px solid #fff7f7;
    color: #eee;
}
.layui-form-select .layui-edge {
    margin-top: 10px;
}
.layui-form-selected .layui-edge {
    margin-top: 3px;
}
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <!--表单提交-->
            <form class="layui-form" url="{:url('admin/api/addons_set',array('id'=>input('id')))}" t_url="javascript:;">
                <div class="layui-tab">
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show layui-row">
                            <!--配置开始-->
                            {foreach name=":admin_config(input('id'))" item="v" key="k"}
                            <div class="layui-col-md{$v.md}">
                                <div class="layui-form-item">
                                <label class="layui-form-label">{$v.title} 
                                <input type="text" class="addonsfuzhi" value=" &#123;:addons('{:input('id')}','{$k}')&#125;"></label>
                                    <div class="layui-input-block">
                                        {if $v.type=='单选框'}
                                        {foreach name="$v.options" item="opv" key="opk"}
                                        <input type="radio" name="config[{$k}]" value="{$opk}" title="{$opv}" {if $opk == addons(input('id'), $k)}checked=""{/if}>
                                        {/foreach}
                                        {/if}
                                        {if $v.type=='选择框'}
                                        <select name="config[{$k}]" lay-verify="{$v.required}">
                                            <option value=""></option>
                                            {foreach name="$v.options" item="opv" key="opk"}
                                            <option value="{$opk}" {if $opk == addons(input('id'), $k)}selected="selected"{/if}>{$opv}</option>
                                            {/foreach}
                                        </select>
                                        {/if}
                                        {if $v.type=='输入框'}
                                        <input type="text" name="config[{$k}]" value="{:addons(input('id'), $k)}" placeholder="请输入内容" required  lay-verify="{$v.required}" autocomplete="off" class="layui-input">
                                        {/if}
                                        {if $v.type=='密码框'}
                                        <input type="password" name="config[{$k}]" value="{:addons(input('id'), $k)}" required  lay-verify="{$v.required}" autocomplete="off" class="layui-input">
                                        {/if}
                                        {if $v.type=='文本域'}
                                        <textarea name="config[{$k}]" rows="{$v.rows}" placeholder="请输入内容" class="layui-textarea">{:addons(input('id'), $k)}</textarea>
                                        {/if}
                                        {if $v.type=='附件'}
                                        <input type="text" name="config[{$k}]" id="{$k}" value="{:addons(input('id'), $k)}" required  lay-verify="{$v.required}" placeholder="可直接填写地址" autocomplete="off" class="layui-input">
                                        <button type="button" class="layui-btn layui-btn-normal s{$k} upfujian">上传</button>
                                        <script type="text/javascript">
                                          layui.use(['form', 'upload', 'jquery']
                                          ,function(){
                                              var form = layui.form,
                                              upload = layui.upload,
                                              jq = layui.jquery;
                                              upload.render({
                                              elem: '.s{$k}',
                                              url: "{:url("admin/up/up")}",
                                              accept: 'file',
                                              done: function(res) {
                                                  if (res.code == '1') {
                                                    jq('#{$k}').val(res.path);
                                                    return layer.msg(res.msg);
                                                  } else {
                                                    return layer.msg(res.msg);
                                                  }
                                              }
                                            });
                                          });
                                          </script>
                                        {/if}
                                        <!--1.01新增-->
                                        {if $v.type=='颜色'}
                                        <input type="color" name="config[{$k}]" value="{:addons(input('id'), $k)}" placeholder="请选择颜色" class="layui-input" id="form-input{$k}">
                                        {/if}
                                        {if $v.type=='时间'}
                                        <input type="date" name="config[{$k}]" value="{:addons(input('id'), $k)}" placeholder="请选择时间" class="layui-input" id="form-input{$k}">
                                        {/if}
                                    </div>
                                </div>
                            </div>
                            {/foreach}
                            <!--配置end-->
                        </div>
                    </div>
                </div> 
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" lay-submit="" lay-filter="cms">立即提交</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{include file="app/admin/view/footer.html"}